home *** CD-ROM | disk | FTP | other *** search
- -----------------------------------------
- -- INTRO IMAGE BOX
- -----------------------------------------
-
- dofile( "Scripts/IntroImagePopup.lua" )
- dofile( "Scripts/CinemaSystem.lua" )
-
- -----------------------------------------
- -- GAME INTRO
- -----------------------------------------
-
- -- Create all the data used by the intro:
- function IntroStartup()
- G.SetLoopingMusic( "Music/moxie_socks.mp3");
-
- -- Recreate the camera:
- local cam = G.GetCogName( "Camera" )
- if( cam ~= nil and cam.IsValid() ) then
- cam.Destroy()
- end
-
- IntroZoomSize = false
- SetImagePopupTiming( 0, 1, 1.5 );
- IntroImageSize = Vector3(2, 2, 0 )
- IntroImagePopup( "Textures/Black.bmp" )
-
- IntroCam = G.Create( "Data/GameCamera.xml" );
- IntroCam.EnableCamera( true, true, true )
-
- IntroCam.SetPosition( Vector3( 220, 5, 330 ) )
- IntroCam.SetDirection( Vector3( 0.1,0.25,-1) )
-
- -- Create the level to place the camera on:
- IntroLevel = G.Create( "Data/Levels/Campaign1.xml" )--IntroLevel.xml")
-
-
- --local towerPos = Tower.GetPosition();
- --IntroCam.CinemaLookAt( Tower );
-
- -- Create the starting Invaders, and hand:
- G.SetLightTime( 6 );
-
-
- -- PRELOAD ALL OTHER GAME ASSETS!
-
- StartCinematic()
- end
-
- function IntroShutdown()
-
- EndCinematic()
-
- local lvl = G.GetCogName( "IntroLevel" )
-
- if( lvl ~= nil and lvl.IsValid() ) then
- lvl.Destroy()
- end
-
- GMain["IntroUpdate"] = nil
- KillImagePopup()
-
- G.SimpleStopSound( "IntroMusic" );
-
- G.DestroyGroup("invaders");
- G.DestroyGroup("spawners");
- G.DestroyGroup("tower");
- G.DestroyGroup("traps");
- G.DestroyGroup("walls");
- G.DestroyGroup("effects");
- G.DestroyGroup("cursor");
- G.DestroyGroup("level");
- G.DestroyGroup("doodads");
-
- G.SunMoveRate( 0 )
- G.SetTimeOfDay( 0 )
- G.SetLightTime( 0 );
-
- KillCinemaBars();
-
- G.ActivateBackground( 0 );
-
- G.DestroyGroup("camera");
- CreateBasicCamera() -- ALWAYS have an active camera
- end
-
-
- -- 255, (20), 190
- function IntroSequence()
-
- -- Random weather
- G.DestroyGroup( "effects" );
-
- if( math.random(3) == 1 ) then
- G.Create( "Data/RainCell.xml" )
- elseif( math.random(5) == 1 ) then
- G.Create( "Data/SnowCell.xml" )
- end
-
- -- Fade in
- G.SunMoveRate( -0.05 )
- G.SetTimeOfDay( 0.35 * math.pi )
-
- FadeIn( 1.5 );
- GameWait( 1.5 )
-
- -- Show DP logo
- -- SetImagePopupTiming( 0.5, 1, 0.5 );
- -- IntroImageSize = Vector3(1.00, 0.75, 0 )
- -- IntroImagePopup( "Textures/DP512.png" )
- -- GameWait( 2 )
-
- -- Show 7E logo
- SetImagePopupTiming( 1, 2, 1 );
- IntroImageSize = Vector3(0.75, 0.75, 0 )
- IntroImagePopup( "Textures/GearLogo.png" )
- GameWait( 4 ) -- xchanged
-
- SetImagePopupTiming( 1, 79, 5 )
- IntroImageSize = Vector3(2.0, 1.0, 0 )
- IntroImagePopup( "Textures/Logo_2.png" )
- GameWait( 1 )
-
- -- Plot intro:
- -- "One day..."
- -- "I'm traitor!"
- -- "Sanctuary!"
- -- Spawns invaders
- -- "We'll get you!"
- -- Hammers, splat
- -- they attack and the Plot intro fades to the pretty intro
-
- -- Loop forever:
- GameWait( 75 )
- FadeOut( 1.5 );
- GameWait( 1.5 )
- --[[
- for loopnum = 0, 10 do
- -- Create an invader, kill the previous one
- local invName;
- local tempNum = math.random(0,5);
-
- if( tempNum == 0 ) then
- invName = "Basic"
- elseif( tempNum == 1 ) then
- invName = "Miner"
- elseif( tempNum == 2 ) then
- invName = "Spiker"
- elseif( tempNum == 3 ) then
- invName = "Squad"
- elseif( tempNum == 4 ) then
- invName = "Bomber"
- elseif( tempNum == 5 ) then
- invName = "Stacker"
- end
-
- local invToKill = G.CreateAt( invName, Vector3( 200, 0, 100) )
- -- Vector3( math.random(-5,5), 0, math.random(-5,5) ) )
- GameWait( 5 )
-
- invToKill.Destroy()
- end
- FadeOut( 1.5 );
- GameWait( 1.5 )
-
- IntroZoomSize = false
- SetImagePopupTiming( 0, 0.05, 1.5 );
- IntroImageSize = Vector3(2, 2, 0 )
- IntroImagePopup( "Textures/Black.bmp" )
-
- G.SunMoveRate( -0.05 )
- G.SetTimeOfDay( 0.35 * math.pi )
-
- local lookAtPoint = Vector3( 255, 20, 190 )
- local camPos = Vector3( 300, 6.5, 150 )
- -- local camDir = lookAtPoint - camPos -- Vector3( -0.725, 0.22, 0.65 )
-
- IntroCam.SetPosition( camPos );
- IntroCam.SetDirection( lookAtPoint - camPos );
-
- GameWait( 1.5 );
-
- -- Play Intro Music
- G.SimpleLoadSoundVar( "IntroMusic", "SFX/9th.ogg", 0 );
- G.SimplePlaySound( "IntroMusic" );
-
- -- Fade in the Digipen logo
- IntroZoomSize = true
- SetImagePopupTiming( 0.05, 1.2, 0.05 );
- IntroImageSize = Vector3(1.00, 0.75, 0 )
- IntroImagePopup( "Textures/DP512.png" )
- GameWait( 1.5 )
-
- -- Fade in the Seventh Sigma logo
- SetImagePopupTiming( 0.05, 1.2, 0.05 );
- IntroImageSize = Vector3(0.75, 0.75, 0 )
- IntroImagePopup( "Textures/GearLogo.png" )
- GameWait( 1.75 )
-
- -- The logo fades in and a "Click Enter Menu" button appears
- SetImagePopupTiming( 0.1, 58, 5 )
- IntroImageSize = Vector3(2.0, 1.0, 0 )
- IntroImagePopup( "Textures/Logo_2.png" )
- GameWait( 1 )
-
- -- Zoom in on 3 invader and some flowers
- G.CreateAt( "Basic", Vector3( 250, 50, 210 ) )
- G.CreateAt( "Spiker", Vector3( 240, 50, 170 ) )
- G.CreateAt( "Stacker", Vector3( 270, 50, 185 ) )
- G.CreateAt( "Basic", Vector3( 260, 50, 170 ) )
- G.CreateAt( "Spiker", Vector3( 275, 50, 200 ) )
- G.CreateAt( "Stacker", Vector3( 240, 50, 170 ) )
-
- -- Raise up and circle around the tower:
-
- local starttime = GameTime;
- while( GameTime - starttime < 10 ) do
- camPos[1] = camPos[1] + GameTimeDiff * 5;
- IntroCam.SetDirection( lookAtPoint - camPos );
- IntroCam.SetPosition( camPos );
- coroutine.yield();
- end
-
- starttime = GameTime;
- startSpinVal = math.pi * 1.75 * 4.0
-
- G.SunMoveRate( -0.03 )
- while( GameTime - starttime < 35 ) do
- startSpinVal = startSpinVal + GameTimeDiff
- camPos[0] = 255 + math.cos( startSpinVal / 4.0 ) * 60
- camPos[2] = 190 + math.sin( startSpinVal / 4.0 ) * 50
- IntroCam.SetDirection( lookAtPoint - camPos );
- IntroCam.SetPosition( camPos );
- coroutine.yield();
- end
-
- G.SunMoveRate( -0.05 )
- starttime = GameTime;
- while( GameTime - starttime < 11 ) do
- camPos[1] = camPos[1] - GameTimeDiff * 5;
- IntroCam.SetDirection( lookAtPoint - camPos );
- IntroCam.SetPosition( camPos );
- coroutine.yield();
- end
-
- GameWait( 8 )
-
- IntroZoomSize = false
- SetImagePopupTiming( 2, 10, 0 );
- IntroImageSize = Vector3(2, 2, 0 )
- IntroImagePopup( "Textures/Black.bmp" )
-
- GameWait( 2 )
-
- -- Invader happy sounds
- -- Invaders are smiling and walking back and forth when ...
-
- -- Dramatic Swoosh sound
- -- The shadow of the hand moves over them ...
-
- -- Invaders stop, have Confusion effect ...
-
- -- Walls drop on flowers
-
- -- Invaders switch to MAD version
-
- -- New invaders come in from the background
-
- -- Zoom back and watch as invaders attack a newly built tower
-
- -- After 1-2 minutes, restart the intro:
- -- GameWait( 60 )
-
-
- G.DestroyGroup("invaders");
- G.DestroyGroup("tower");
- G.DestroyGroup("walls");
-
- GameWait( 1 ) -- Wait atleast 1 section for the objects to be deleted!
-
- IntroLevel.LoadLevelData()
-
- ]]--
- end
-
- function CheckIntroCompletion()
- -- Keep updating as long as the user doesn't click/
- if( --false and (
- G.KeyTriggered( "Space" ) or
- G.KeyTriggered( "Enter" ) or
- G.KeyTriggered( "Escape" ) or
- G.MouseTriggered( 0 ) or
- G.MouseTriggered( 1 ) ) then
-
- -- If not done with the intro,
- -- Skip to the end of the intro:
-
- -- Else, open the Main Menu:
- IntroShutdown()
- MainMenu.OpenWindow( "StartWindow", false );
- --invaderpeida crash
- G.File( "Data/BasicCamera.xml" );
-
- -- dofile( "Scripts/Startup.lua" )
- end
-
- end
-
- -- Update Function:
- function IntroUpdate()
-
- CheckIntroCompletion()
-
- -- Update the Intro Sequence
- if( introRoutine ) then
- local con, error = coroutine.resume( introRoutine )
-
- -- Restart the Intro Sequence:
- if( con == false ) then
- G.Mes( error )
- introRoutine = coroutine.create( IntroSequence )
- end
- end
-
- end
-
-
- function PlayIntro()
- MainMenu.CloseWindow( "StartWindow" )
- MainMenu.CloseWindow( "BonusWindow" )
- G.ActivateBackground( -1 );
- IntroStartup()
- introRoutine = coroutine.create(IntroSequence);
- GMain["IntroUpdate"] = IntroUpdate;
- end
-
-
-
-
-